﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IServiceBase.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the  interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Services.Interfaces
{
    using System.Collections.Generic;
    using System.ServiceModel;

    /// <summary>
    /// Defines the <seealso cref="IServiceBase{T}"/> interface.
    /// </summary>
    /// <typeparam name="T">Type of repository</typeparam>
    [ServiceContract]
    public interface IServiceBase<T>
    {
        /// <summary>
        /// Gets the filtered.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="pageNo">The page no.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>List of filtered items</returns>
        [OperationContract]
        IEnumerable<T> List(T filter = default(T), int? pageNo = null, int? pageSize = null);

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns>The id of entity being added.</returns>
        [OperationContract]
        int Add(T entity);

        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        [OperationContract]
        void Update(T entity);

        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        [OperationContract]
        void Delete(T entity);
    }
}